class AwareObj{
  
  AwareObj(){
  };
  
  void update(){
  };
  
  void debugOutput(){
  };
  
  boolean dead() {
    return false;
  }
};

class AwareList extends AwareObj{

  ArrayList objs;         // An arraylist for all the subObjects
  boolean debug;

  AwareList() {
    super();                       
    debug = false;
    objs = new ArrayList();              // Initialize the arraylist
  }

  void setDebug( boolean b){
    debug = b;
  }

  void debugOutput(){
  };
  
  void update() {
    // Cycle through the ArrayList backwards b/c we are deleting
    if( objs.size() > 0){
    for (int i = objs.size()-1; i >= 0; i--) {
      AwareObj p = (AwareObj) objs.get(i);
      p.update();
      if( debug){
        p.debugOutput();
      };
      if (p.dead()) {
        objs.remove(i);
      }
      }
    }
  }

  void addObj( AwareObj o) {
    objs.add( o);
  }
  
  // A method to test if the Environment still has Objects
  boolean dead() {
    return false;
/*
    if (objs.isEmpty()) {
      return true;
    } else {
      return false;
    }
*/
  }
  
  int ObjCt(){
    return objs.size();
  }

}
